package com.bbs.service.impl;

import com.bbs.dao.PostUserDao;
import com.bbs.entity.PostUser;
import com.bbs.service.PostUserService;
import com.bbs.utils.MyUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service("postuserservice")
public class PostUserServiceImpl implements PostUserService {
    @Autowired
    private PostUserDao postUserDao;
    @Override
    public int save(PostUser postUser) {
//更新点赞数
        postUser.setCreateTime(MyUtil.formatDate(new Date()));
        postUserDao.updatelikeCount(postUser.getPid());
        return postUserDao.save(postUser);
    }

    @Override
    public PostUser findByPIdAndUid(int pid, int uid) {
        return postUserDao.findByPidAndUid(pid,uid);
    }


}
